package com.yashi.springmvcjbpm.mail;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

public class MyAuthenticator extends Authenticator {

	
	private String userName;
	private String passWord;

	/**
	 * @param userName
	 *            the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * @param passWord
	 *            the passWord to set
	 */
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public MyAuthenticator() {
		System.out.println("自定义验证器加载...");
	}

	public MyAuthenticator(String userName, String passWord) {
		 this.userName = userName;   
	        this.passWord = passWord;   
	}

	/*
	 * (non- Javadoc )
	 * 
	 * @see javax.mail.Authenticator#getPasswordAuthentication()
	 */
	@Override
	protected PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(userName, passWord);
	}

}
